package com.lambda;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class ListAnay {

    @Test
    public void arrMerge(){
        int[] arr1 = {1,2,3,0,0,0};
        int[] arr2 = {2,5,6};
        int m=3,n=3;

        this.merge(arr1,m,arr2,n);
    }

    public void merge(int[] nums1, int m, int[] nums2, int n) {
        List<Integer> list1 = Arrays.stream(nums1).boxed().collect(Collectors.toList()).subList(0,m);
        List<Integer> list2 = Arrays.stream(nums2).boxed().collect(Collectors.toList()).subList(0,n);

        list1.addAll(list2);

        list1.stream().sorted().forEach(System.out::println);

        /*Arrays.stream(new String[]{"petee","jack","jim"})
                .collect(Collectors.toCollection(ArrayList::new)).forEach(System.out::println);*/
    }
}
